home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / gamesmaster / demosrc / agamirror.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  4.8 KB  |  173 lines

  1. ;AGA Mirror Demo
  2. ;---------------
  3. ;Demo of the mirroring effect.
  4. ;
  5. ;Use  the  joystick  to  move  the mirror up and down.  When this effect is
  6. ;combined  with  a decrease in palette values at the same line, you can
  7. ;create the illusion of water.
  8.  
  9.     opt    o+
  10.  
  11.     INCLUDE    "exec/exec_lib.i"
  12.     INCLUDE    "games/games_lib.i"
  13.     INCLUDE    "games/games.i"
  14.  
  15. LOCAL    =    0
  16.  
  17. CALL    MACRO
  18.     jsr    _LVO\1(a6)
  19.     ENDM
  20.  
  21.     SECTION    "MirrorDemo",CODE
  22.  
  23. ;===========================================================================;
  24. ;                             INITIALISE DEMO
  25. ;===========================================================================;
  26.  
  27. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  28.     move.l    ($4).w,a6
  29.     lea    GMS_Name(pc),a1
  30.     moveq    #$00,d0
  31.     CALL    OpenLibrary
  32.     move.l    d0,GMS_Base
  33.     beq    Quit
  34.  
  35.     move.l    GMS_Base(pc),a6
  36.     CALL    SetUserPri
  37.  
  38.     move.l    GMS_Base(pc),a6          ;Initialise our screen.
  39.     lea    ScreenStruct(pc),a0
  40.     CALL    Add_Screen
  41.     tst.l    d0
  42.     bne.s    Error
  43.  
  44.     move.l    SS_MemPtr1(a0),a1        ;Destination = SS_MemPtr1.
  45.     lea    PackedPicFile(pc),a0     ;File Name.
  46.     CALL    QuickLoad
  47.     tst.l    d0
  48.     beq.s    Error
  49.  
  50.     lea    ScreenStruct(pc),a0      ;Unpack the data on top of itself.
  51.     move.l    SS_MemPtr1(a0),a1
  52.     move.l    a1,a0
  53.     moveq    #$00,d0
  54.     CALL    SmartUnpack
  55.  
  56.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  57.     CALL    Show_Screen
  58.  
  59. ;===========================================================================;
  60. ;                                MAIN CODE
  61. ;===========================================================================;
  62.  
  63. Loop:    CALL    Wait_OSVBL
  64.     CALL    Update_RasterList
  65.     moveq    #JPORT2,d0
  66.     moveq    #JT_SWITCH,d1
  67.     CALL    Read_JoyPort
  68. .up    btst    #JS_UP,d0
  69.     beq.s    .down
  70.     subq.w    #1,RasterList+2
  71. .down    btst    #JS_DOWN,d0
  72.     beq.s    .fire
  73.     addq.w    #1,RasterList+2
  74. .fire    btst    #JS_FIRE1,d0
  75.     beq.s    Loop
  76.  
  77. Fade:    CALL    Wait_OSVBL
  78.     moveq    #2,d0                    ;d0 = Speed of fade.
  79.     CALL    B24_FadeToBlack          ;Do the fade routine.
  80.     tst.w    d0                       ;Has the fade finished yet?
  81.     bne.s    Fade                     ;If not, keep doing it.
  82.  
  83. ;===========================================================================;
  84. ;                              RETURN TO DOS
  85. ;===========================================================================;
  86.  
  87.     CALL    Delete_Screen            ;Give back screen memory etc.
  88. Error    move.l    GMS_Base(pc),a1
  89.     move.l    ($4).w,a6
  90.     CALL    CloseLibrary
  91. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  92.     moveq    #$00,d0
  93.     rts
  94.  
  95. ;===========================================================================;
  96. ;                                  DATA
  97. ;===========================================================================;
  98.  
  99. GMS_Name:
  100.     dc.b    "games.library",0
  101.     even
  102. GMS_Base:
  103.     dc.l    0
  104.  
  105. AMT_PLANES =    7
  106.  
  107. ScreenStruct:
  108.     dc.l    "GSV1"
  109.     dc.l    0,0,0                    ;Screen_Mem1/2/3
  110.     dc.l    0                        ;Screen link.
  111.     dc.l    ScreenPalette            ;Address of screen palette.
  112.     dc.l    RasterList               ;Address of rasterlist.
  113.     dc.l    256                      ;Amt of colours in palette.
  114.     dc.w    256,320,320/8            ;Screen Height, Width, Width/8
  115.     dc.w    256,320,320/8            ;Pic Height, Width, Width/8
  116.     dc.w    AMT_PLANES               ;Amt_Planes
  117.     dc.w    0,0                      ;Top Of Screen, X/Y
  118.     dc.w    0                        ;Scroll buffer in pixels/8.
  119.     dc.w    0,0                      ;X/Y counters (for scrolling).
  120.     dc.l    NOBURST                  ;Special attributes.
  121.     dc.w    LORES|_24BITCOL          ;Screen mode.
  122.     dc.b    INTERLEAVED              ;Screen type
  123.     dc.b    0                        ;Screen Is Being Displayed?
  124.     dc.l    0,0                      ;Reserved area.
  125.     even
  126.  
  127. RasterList:
  128.     WAITLINE 164
  129.     MIRROR
  130.     RASTEND
  131.  
  132. ScreenPalette:
  133.     dc.l    $000000,$FFFFFF,$FAF5F2,$FAE8E7
  134.     dc.l    $EEDED5,$E8D4C8,$DDC0AF,$D7B5A2
  135.     dc.l    $D1AC96,$DCA491,$CBA38B,$C5997E
  136.     dc.l    $BD8E74,$B5846A,$AD7A5F,$A57056
  137.     dc.l    $9D674D,$955D44,$8C533B,$844B34
  138.     dc.l    $7C432D,$743B26,$6C3320,$642D1B
  139.     dc.l    $5C2616,$532010,$4A1D0C,$411A09
  140.     dc.l    $381606,$2F1204,$260F02,$1D0C00
  141.     dc.l    $AC783A,$A67139,$A06C39,$986638
  142.     dc.l    $995F36,$906037,$8C5C36,$945733
  143.     dc.l    $865735,$905030,$7E5133,$8D4B2E
  144.     dc.l    $764B31,$6E4630,$8A462D,$64412B
  145.     dc.l    $5D3D27,$593A24,$543822,$50351F
  146.     dc.l    $4B341D,$47301A,$592218,$402D17
  147.     dc.l    $382813,$3B2007,$302310,$2B200D
  148.     dc.l    $331100,$430907,$3C0504,$2E0202
  149.     dc.l    $B48038,$B7743D,$AE6350,$A85D4A
  150.     dc.l    $A35644,$9E503E,$994A39,$944534
  151.     dc.l    $9F4336,$8E3F30,$87412B,$87382A
  152.     dc.l    $823628,$803226,$792C21,$72251C
  153.     dc.l    $E1AB98,$DBA28C,$D79C89,$D29582
  154.     dc.l    $CD8D7A,$C88672,$C27E6B,$BD7764
  155.     dc.l    $B8705D,$B36A57,$BB5244,$AD4A3D
  156.     dc.l    $C8594A,$7F7444,$847D49,$67271E
  157.     dc.l    $6C2219,$651D15,$5E1711,$57130E
  158.     dc.l    $500F0B,$4A0C09,$350303,$270000
  159.     dc.l    $89874E,$8C8E53,$8C9358,$8E9D62
  160.     dc.l    $C6904A,$9AA467,$CD9E51,$AFAE6F
  161.     dc.l    $E3D765,$D5AE58,$BCAD78,$C1AC7C
  162.     dc.l    $CBAA82,$D5A588,$EAA09B,$ECA7A2
  163.     dc.l    $EDADA9,$EFB5B1,$F0BBB8,$F2C2BF
  164.     dc.l    $F4CBC8,$F5D1CF,$F7D9D7,$FDF7F7
  165.  
  166. PackedPicFile:
  167.     IFNE    LOCAL
  168.     dc.b    "GAMESLIB:"
  169.     ENDC
  170.     dc.b    "data/Yattering128.pak",0
  171.     even
  172.  
  173.